package com.ruoyi.system.mysql1.service.impl;

import com.ruoyi.system.api.domain.SysOperLog;
import com.ruoyi.system.mysql1.service.TCCService1;
import io.seata.rm.tcc.api.BusinessActionContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class TCCService1Inpl implements TCCService1 {
    @Override
    public boolean prepare(SysOperLog operLog) {
        if(operLog.getOperId() == 12){
            log.error("mysql1 TCCServiceInpl prepare error");
            return false;
        }
        log.info("mysql1 TCCServiceInpl prepare");
        return true;
    }

    @Override
    public boolean commit(BusinessActionContext context) {
        log.info("mysql1 TCCServiceInpl commit");
        return true;
    }

    @Override
    public boolean rollback(BusinessActionContext context) {
        log.info("mysql1 TCCServiceInpl rollback");
        return true;
    }
}
